package com.hsgene.order.constants.v1;

/**
 * 支付状态
 *
 * @author wangbing
 * @version 1.0, 2018/9/19
 */
public enum PaymentIntStatus {
    /**
     * 状态枚举
     */
    INIT(0, "未支付"),

    ON_GOING(1, "支付中"),

    PAID(2, "已支付"),

    UNDEFINED(99, "undefined");

    private final int code;

    private final String desc;

    public String getDesc() {
        return desc;
    }

    public int getCode() {
        return code;
    }

    public static PaymentIntStatus getEnum(int code) {
        for (PaymentIntStatus status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return UNDEFINED;
    }

    PaymentIntStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
